<template>
  <div>
    <el-dialog
      title="删除提示"
      :visible.sync="dialogVisible"
      width="30%"
      :before-close="handleClose"
    >
      <!-- <span class="text-primary">Purvar0001</span> -->
      是否删除当前对象BOM实例？
      <span slot="footer" class="dialog-footer">
        <el-button type="text" class="float-left" @click="handleClose">取 消</el-button>
        <el-button type="text" plain @click="handleDelete">删除</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { deleteObjectbom } from '@/api/frontPage/materials'

export default {
  name: 'DialogDelete',
  props: {
    query: {
      type: Object,
      default: _ => {}
    }
  },
  inject: ['refreshTree'],
  data() {
    return {
      dialogVisible: false,
      multipleSelection: []
    }
  },
  created() {

  },
  methods: {
    /* 删除操作 */
    handleDelete() {
      this.queryDeleteObjectbom()
    },
    /* 删除请求 */
    queryDeleteObjectbom() {
      deleteObjectbom(this.query).then((res) => {
        this.$message.success(res.message)
        this.$parent.queryBomListData()
        this.refreshTree()
      })
      this.handleClose()
    },

    handleClose() {
      this.dialogVisible = !this.dialogVisible
      this.multipleSelection = []
    }
  }
}
</script>

<style lang="scss" scoped></style>
